{% extends "base.html"  %}
{% load static %}

{% block link %}
<link rel="shortcut icon" href="{% static "favicon.ico" %}">
<link rel="stylesheet" href="{% static "css/common.css" %}">
<link rel="stylesheet" href="{% static "css/index.css" %}">
{% endblock %}

{% block body  %}
<body class="index">
	<div class="header">
		<a href="/" class="logo"><img src="{% static "image/logo.jpg" %}"></a>
		<div class="search-box">
	    <form id="searchForm" action="{% url 'search' 1 %}" method="post">
        {% csrf_token %}
	        <div class="search-keyword">
	            <input name="kword" type="text" class="keyword" maxlength="120">
	        </div>
	        <input id="subSerch" type="submit" class="search-button" value="搜 索">
	    </form>
	    <div id="suggest" class="search-suggest"></div>
  		<div class="search-hot-words">
			{% for s in searchs  %}
				<a target="play" href="{% url 'play' s.document.id %}">{{ s.document.name }}</a>
			{% endfor  %}
  		</div>
  	</div>
	</div>
	<div class="nav-box">
    <div class="nav-box-inner">
        <ul class="nav clearfix">
            <li><a href="{% url 'index' %}">首页</a></li>
            <li><a href="{% url 'ranking' %}" target="_blank">公文排行</a></li>
            <li><a href="{% url 'home' 1 %}" target="_blank">用户中心</a></li>
            {% if user.username %}
                <li><a href="{% url 'logout' %}" target="_blank">退出登录</a></li>
                <h4>欢迎回来，{{ user.username }}</h4>
            {%  endif %}
        </ul>
        <div class="category-nav">
            <div class="category-nav-header">
                <strong><a href="javascript:;" title="">公文分类</a></strong>
            </div>
            <div class="category-nav-body">
                <div id="J_CategoryItems" class="category-items">
                {% for l in labels  %}
                    <div class="item" data-index="1"><h3>
                        <a href="{% url 'ranking' %}?type={{ l.id }}">{{ l.name }}</a></h3>
                    </div>
                {% endfor  %}
                </div>
            </div>
        </div>
    </div>
	<div class="wrapper clearfix">
		<div class="main">
			<div id="J_FocusSlider" class="focus">
				<div id="bannerLeftBtn" class="banner_btn"></div>
				<ul class="focus-list f_w">
                    <li class="f_s"><a target="play" href="{% url 'play' 1  %}" class="layz_load" >
                        <img data-src="{% static '/image/datu-7.png' %}"  width="750" height="275"></a>
                    </li>
					<li class="f_s"><a target="play" href="{% url 'play' 1 %}" class="layz_load" >
                        <img data-src="{% static '/image/datu-6.png' %}"  width="750" height="275"></a>
                    </li>
                    <li class="f_s"><a target="play" href="{% url 'play' 1 %}" class="layz_load" >
                        <img data-src="{% static '/image/datu-3.png' %}"  width="750" height="275"></a>
                    </li>
				</ul>
				<div id="bannerRightBtn" class="banner_btn"></div>
			</div>
		</div>
		<div class="aside">
			<h2>热门公文</h2>
			<ul>
				{% for p in popular %}
					<li><span>{{ forloop.counter }}</span>
                        <a target="play" href="{% url 'play' p.document.id %}">{{ p.document.name }}</a>
                    </li>
				{% endfor  %}
			</ul>
		</div>
	</div>
	<div class="today clearfix">
		<div class="today-header">
            <i></i>
			<h2>最新公文</h2>
		</div>
		<div class="today-list-box slide">
			<div id="J_TodayRec" class="today-list">
				<ul>
                {% for r in recommend %}
                    <li>
                    <a class="pic layz_load pic_po" target="play" href="{% url 'play' r.id %}">
                        <img data-src="{{ r.img.url }}"></a>
                    <div class="name">
                        <h3><a target="play" href="{% url 'play' r.id %}" >{{ r.name }}</a></h3>
                        <div class="singer"><span>{{ r.person }}</span></div>
                        <div class="times">发行时间：<span>{{ r.time |date:"Y-m-d" }}</span></div>
                    </div>
                    <a target="play" href="{% url 'play' r.id %}" class="today-buy-button" >查看></a>
                    </li>
                {% endfor  %}
				</ul>
			</div>
		</div>
	</div><!--end today-->
	<div class="section">
		<ul id="J_Tab" class="tab-trigger">
	  	<li data-cur="0" class="current t_c">最多搜索</li>
        <li data-cur="1" class="t_c">最多下载</li>
		</ul>
		<div class="tab-container">
	    <div id="J_Tab_Con" class="tab-container-cell">
            {% for tab in tabs %}
                {% if forloop.first %}
                    <ul class="product-list clearfix t_s current">
                {% else %}
                    <ul class="product-list clearfix t_s" style="display:none;">
                {% endif %}
                    {% for item in tab %}
                    <li>
                        <a target="play" href="{% url 'play' item.document.id %}" class="pic layz_load pic_po" >
                            <img data-src="{{ item.document.img.url }}"></a>
                        <h3><a target="play" href="{% url 'play' item.document.id %}" >{{ item.document.name }}</a></h3>
                        <div class="singer"><span>{{ item.document.person }}</span></div>
                        {% if tabs.0  == tab %}
                        <div class="times">搜索次数：<span>{{ item.search }}</span></div>
                        {% else %}
                        <div class="times">下载次数：<span>{{ item.download }}</span></div>
                        {% endif %}
                    </li>
                    {% endfor %}
                    </ul>
            {% endfor %}
        </div>
        </div>
    </div><!--end section-->
	</div>
	<script data-main="{% static "js/index.js" %}" src="{% static "js/require.js" %}"></script>
</body>
{% endblock  %}
